-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use safecast for any downcasting #2306
Use safecast for any downcasting #2306
Conversation
contracts/contracts/token/OUSD.sol
Outdated
@@ -277,41 +278,41 @@ contract OUSD is Governable { | |||
returns (int256 rebasingCreditsDiff, int256 nonRebasingSupplyDiff) | |||
{ | |||
RebaseOptions state = rebaseState[account]; | |||
int256 currentBalance = int256(balanceOf(account)); | |||
uint256 newBalance = (currentBalance + balanceChange).toUint256(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this change away from uint256
? A balance is a number that can only be positive. It also looks like this changes makes us have to do many more conversions later in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because of the check on line 283. Though you are right this could be done in a cleaner way. Done here: 21f7eb7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Good catch.
0ab7bc8
into
sparrowDom/rebaseElsewhere_v2
uint256